<?php
class ModelAccountPassreset extends Model {

	public function addPassreset($passrequest,$username,$activecode) {
		$SQL = "INSERT INTO " . DB_PREFIX . "passreset " .
			"SET username = '" . $this->db->escape($username) . "', " .
				"passrequest = '" . $this->db->escape($passrequest) . "', " .
				"activecode = '" . $this->db->escape($activecode) . "'"; 
				
      	$this->db->query($SQL);
}
      public function getActivecodeByUsername($username) {
		$query = $this->db->query("SELECT passrequest,activecode FROM " . DB_PREFIX . "passreset WHERE username = '" . $this->db->escape($username) . "' AND active=0");

		return $query->row;
	}

 public function changeActiveByUsername($username) {
		 $this->db->query("UPDATE  " . DB_PREFIX . "passreset SET active=1 WHERE username = '" . $this->db->escape($username) . "' AND active=0");

		
	}

}
?>